package com.hspedu.Homework;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

public class Homework03 {
    public static void main(String[] args) {
        HashMap hashMap = new HashMap();
        hashMap.put("jack",650);
        hashMap.put("tom",1200);
        hashMap.put("smith",2900);
        System.out.println(hashMap);
        hashMap.replace("jack",2600);
        System.out.println(hashMap);
        Set set = hashMap.keySet();

        Iterator iterator = set.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
//            System.out.println(hashMap.get(next));
            int salary = (int)hashMap.get(next)+1000;
            hashMap.replace(next, salary);
        }
        System.out.println(hashMap);

        iterator = set.iterator();
        while (iterator.hasNext()){
            Object next = iterator.next();
            System.out.println(hashMap.get(next));
        }
    }
}
